/**
* 版权声明：厦门睿商网络科技有限公司 版权所有 违者必究
* 日    期：2020-12-15
*/
package com.rzico.article.controller.member;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.rzico.article.entity.Talent;
import com.rzico.article.service.TalentService;
import com.rzico.base.BaseController;
import com.rzico.base.CommResult;
import com.rzico.basics.entity.Member;
import com.rzico.basics.service.MemberService;
import com.rzico.entity.PageResult;
import com.rzico.entity.Pageable;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.time.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 达人档案控制层
 *
 * @author Rzico Boot
 * @version 1.0
 * @date 2020-12-15
 */
@Api(description = "达人档案接口")
@RestController
@RequestMapping("/member/talent")
public class TalentMemberController extends BaseController {

    @Autowired
    private TalentService talentService;

    @Autowired
    private MemberService memberService;

    /**
     * 查询单条达人档案
     *
     * @return
    */
    @ApiOperation("查询单条达人档案")
    @GetMapping("/getInfo")
    public CommResult<Talent> getInfo() {
        Member member = memberService.getCurrent();
        Talent result = talentService.findByMember(member.getId());
        Map<String, Object> data = new HashMap<>();
        if (result!=null) {
            data.put("talent", result);
        } else {
            result = new Talent();
            result.setFollow(0);
            result.setArticle(0);
            result.setLove(0);
        }
        return CommResult.success(data);
    }

}
